﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Nextensions.WinApi.Input
{
    public enum MouseEvent : byte
    {
        None,
        Move,
        LDoubleClick,
        LDown,
        LUp,
        RDown,
        RUp,
        Wheel
    } 

    public enum KeyboardEvent : byte
    {
        None,
        KeyDown,
        KeyUp
    }

    public abstract class HookBase
    {
        protected static IntPtr _hHook = IntPtr.Zero;
        protected Win.HookProc _hookProc;

        public HookBase()
        {
            CallNextHook = true;
        }

        public abstract bool Start();

        public void Stop()
        {
            if (_hHook.ToInt32() != 0)
            {
                if (Win.UnhookWindowsHookEx(_hHook.ToInt32()))
                {
                    _hHook = IntPtr.Zero;
                }
            }
        }

        public bool CallNextHook
        {
            get;
            set;
        }
    }
}
